//
//  HMLoginModel.m
//  仿真开发
//
//  Created by Cloud on 2017/3/23.
//  Copyright © 2017年 B.HOPE. All rights reserved.
//

#import "HMLoginModel.h"



@implementation HMLoginModel

- (void)setValue:(id)value forUndefinedKey:(NSString *)key{};

- (NSString *)description
{
    return [NSString stringWithFormat:@"姓名: %@, 年龄: %@, 性别: %@, 身高: %@, 体重: %@, 籍贯: %@, 联系方式: %@, 证件号码: %@,,常居地: %@",_name,_age,_sex,_height,_weight,_address,_phoneNumber,_IdNumber,_residence];
}

- (instancetype)init
{
    self  = [super init];
    _name = @"老王";
    return self;
}

+ (instancetype)loginWithDict:(NSDictionary *)dict
{
    HMLoginModel *loginModel = [[HMLoginModel alloc] init];
    [loginModel setValuesForKeysWithDictionary:dict];
    
    //初始化数据
    loginModel.name = @"老王";
    loginModel.phoneNumber = @"13800138000";
    loginModel.IdNumber = @"1001010010110100";
    loginModel.sex = @"男";
    loginModel.residence = @"深圳";
    
    return loginModel;
    
}

- (void)encodeWithCoder:(NSCoder *)aCoder
{
    [aCoder encodeObject:_name forKey:@"name"];
    [aCoder encodeObject:_age forKey:@"age"];
    [aCoder encodeObject:_sex forKey:@"sex"];
    [aCoder encodeObject:_height forKey:@"height"];
    [aCoder encodeObject:_weight forKey:@"weight"];
    [aCoder encodeObject:_address forKey:@"address"];
    [aCoder encodeObject:_residence forKey:@"residence"];
    [aCoder encodeObject:_phoneNumber forKey:@"phoneNumber"];
    [aCoder encodeObject:_IdNumber forKey:@"IdNumber"];
}

- (instancetype)initWithCoder:(NSCoder *)aDecoder
{
    
    self = [super init];
    
    if(self){
        
        _name = [aDecoder decodeObjectForKey:@"name"];
        _age = [aDecoder decodeObjectForKey:@"age"];
        _sex = [aDecoder decodeObjectForKey:@"sex"];
        _height = [aDecoder decodeObjectForKey:@"height"];
        _weight = [aDecoder decodeObjectForKey:@"weight"];
        _address = [aDecoder decodeObjectForKey:@"address"];
        _residence = [aDecoder decodeObjectForKey:@"residence"];
        _phoneNumber = [aDecoder decodeObjectForKey:@"phoneNumber"];
        _IdNumber = [aDecoder decodeObjectForKey:@"IdNumber"];
    }
    return self;
}
@end
